package flc.ast.utils;

import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.SPUtils;
import com.google.gson.reflect.TypeToken;
import com.stark.midi.lib.model.MidFileBean;

import java.util.List;

import flc.ast.bean.MyCollectBean;


public class AppSpUtils {
    private static final String SP_NAME = "appCollSp";
    private static final SPUtils sSpUtils = SPUtils.getInstance(SP_NAME);

    public static void savePracticeList(List<String> list) {
        String json = GsonUtils.toJson(list);
        sSpUtils.put(Key.key_practice_list, json);
    }

    public static List<String> getPracticeList() {
        String json = sSpUtils.getString(Key.key_practice_list);
        return GsonUtils.fromJson(json, new TypeToken<List<String>>() {
        }.getType());
    }

    public static void saveSongCollectionList(List<MyCollectBean> list) {
        String json = GsonUtils.toJson(list);
        sSpUtils.put(Key.key_song_collection_list, json);
    }

    public static List<MyCollectBean> getSongCollectionList() {
        String json = sSpUtils.getString(Key.key_song_collection_list);
        return GsonUtils.fromJson(json, new TypeToken<List<MyCollectBean>>() {
        }.getType());
    }

    interface Key {
        String key_practice_list = "key_practice_list";

        String key_song_collection_list = "key_song_collection_list";

    }
}